package com.weilele.leisure.time.ui.module.video_cache


import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.FragmentContainer
import androidx.fragment.app.FragmentContainerView
import com.weilele.base.library.BaseActivity
import com.weilele.base.library.BaseBindingActivity
import com.weilele.leisure.time.databinding.ActivityVideoCacheBinding
import com.weilele.mvvm.utils.activity.getActivity
import com.weilele.mvvm.utils.activity.navigateTo
import com.weilele.mvvm.utils.fragment.addFragment
import com.yizisu.playerlibrary.activity.PlayerLibraryCacheFragment

class VideoCacheActivity : BaseBindingActivity<ActivityVideoCacheBinding>()

class VideoOtherCacheActivity : BaseActivity() {
    companion object {
        fun start(view: View, ids: Array<String>?) {
            ids ?: return
            view.getActivity().navigateTo<VideoOtherCacheActivity> {
                it.putExtra("datas", ids)
            }
        }
    }

    override fun onMvvmCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): Any? {
        return FragmentContainerView(this).apply {
            id = View.generateViewId()
            addFragment(
                id, PlayerLibraryCacheFragment.newInstance(
                    intent.getStringArrayExtra("datas")!!
                )
            )
        }
    }

    override fun initUi(savedInstanceState: Bundle?) {
        super.initUi(savedInstanceState)
        title = "其他下载"
    }

    override fun isNeedToolbar(): Boolean {
        return true
    }
}